//package com.yunxin.admin.system.api.core.product;
//
//import cn.hutool.core.collection.CollUtil;
//import cn.hutool.json.JSONObject;
//import com.fasterxml.jackson.core.type.TypeReference;
//import com.yunxin.admin.system.infra.common.constant.SecurityConstants;
//import com.yunxin.admin.system.infra.common.enums.AdminResultCode;
//import com.yunxin.admin.system.infra.framework.resubmit.Resubmit;
//import com.yunxin.admin.system.infra.framework.security.util.SecurityUtils;
//import com.yunxin.admin.system.infra.framework.syslog.AutoLog;
//import com.yunxin.common.exception.BusinessException;
//import com.yunxin.common.result.PageResult;
//import com.yunxin.common.result.Result;
//import com.yunxin.common.utils.JacksonUtils;
//import com.yunxin.core.application.command.product.*;
//import com.yunxin.core.application.dto.merchant.MerchantPageDTO;
//import com.yunxin.core.application.dto.order.OrderCountDTO;
//import com.yunxin.core.application.dto.product.*;
//import com.yunxin.core.application.service.OrderQueryAdminService;
//import com.yunxin.core.application.service.ProductApplicationAdminService;
//import com.yunxin.core.application.service.ProductQueryAdminService;
//import com.yunxin.core.domain.external.channel.ChannelExternalService;
//import com.yunxin.core.domain.external.channel.ChannelProhibitProductService;
//import com.yunxin.core.domain.external.product.ProductBanDetails;
//import com.yunxin.core.domain.external.product.UpdateTheProductDisableRelationshipDto;
//import com.yunxin.core.infra.common.product.enums.ProductCustomSwitchStatusEnum;
//import com.yunxin.core.infra.common.product.enums.ProductPlacementRegionTypeEnum;
//import com.yunxin.core.infra.persistence.entity.channel.ChannelProhibitProduct;
//import com.yunxin.core.infra.persistence.entity.product.ProductInfoDO;
//import com.yunxin.core.utils.infra.common.constant.CommonConstants;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.Parameter;
//import io.swagger.v3.oas.annotations.security.SecurityRequirement;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import jakarta.validation.Valid;
//import jakarta.validation.constraints.NotNull;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.apache.poi.ss.usermodel.Row;
//import org.apache.poi.ss.usermodel.Sheet;
//import org.apache.poi.ss.usermodel.Workbook;
//import org.apache.poi.xssf.usermodel.XSSFWorkbook;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.MediaType;
//import org.springframework.http.ResponseEntity;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
//import java.io.ByteArrayOutputStream;
//import java.io.IOException;
//import java.net.URLEncoder;
//import java.nio.charset.StandardCharsets;
//import java.text.SimpleDateFormat;
//import java.util.*;
//import java.util.function.Function;
//import java.util.stream.Collectors;
//
///**
// * @author zero°
// * @since 2023-05-29
// */
//@Tag(name = "51.产品管理")
//@Slf4j
//@RestController
//@RequestMapping("/core/v1/product")
//@RequiredArgsConstructor
//public class ProductController {
//
//    private final ProductApplicationAdminService productApplicationAdminService;
//
//    private final ProductQueryAdminService productQueryAdminService;
//
//    private final OrderQueryAdminService orderQueryAdminService;
//
//    private final ChannelProhibitProductService channelProhibitProductService;
//
//    @Operation(summary = "新增产品推广信息", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/addProductPromotionInfo")
//    @PreAuthorize("@ss.hasPerm('core:product:add')")
//    @Resubmit
//    @AutoLog(value = "新增产品推广信息")
//    public Result<Long> addProductPromotionInfo(@Validated @RequestBody AddProductPromotionInfoCommand command) {
//        command.setCreator(SecurityUtils.X.getUser().getUsername());
//        command.setProductLabeling(command.getProductLabelingList().stream().map(String::valueOf).collect(Collectors.joining(",")));
//        return Result.success(productApplicationAdminService.addProductPromotionInfo(command));
//    }
//
//    @Operation(summary = "更新产品推广信息", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/updateProductPromotionInfo")
//    @PreAuthorize("@ss.hasPerm('core:product:edit')")
//    @Resubmit
//    @AutoLog(value = "更新产品推广信息")
//    public Result<Boolean> updateProductPromotionInfo(@Validated @RequestBody UpdateProductPromotionInfoCommand command) {
//        command.setEditor(SecurityUtils.X.getUser().getUsername());
//        command.setProductLabeling(command.getProductLabelingList().stream().map(String::valueOf).collect(Collectors.joining(",")));
//        return Result.success(productApplicationAdminService.updateProductPromotionInfo(command));
//    }
//
//    @Operation(summary = "获取产品推广信息", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/getProductPromotionInfo/{productId}")
//    public Result<ProductPromotionInfoDTO> getProductPromotionInfo(@Parameter(description = "产品id") @PathVariable Long productId) {
//        ProductPromotionInfoDTO result = productQueryAdminService.getProductPromotionInfo(productId);
//        result.setProductLabelingList(getList(result.getProductLabeling()));
//        return Result.success(result);
//    }
//
//    @Operation(summary = "操作产品客户配置（新增/更新）", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/operateProductPromotionCustomConfig")
//    @Resubmit
//    @AutoLog(value = "操作产品客户配置")
//    public Result<Boolean> operateProductPromotionCustomConfig(@Validated @RequestBody ProductCustomConfigOperateCommand command) {
//        checkProductPromotionCustomConfigParam(command.getAgeSwitch(), command.getCustomMinAge());
//        checkProductPromotionCustomConfigParam(command.getAgeSwitch(), command.getCustomMaxAge());
//        checkProductPromotionCustomConfigParam(command.getEducationLeveSwitch(), command.getEducationLevelList());
//        checkProductPromotionCustomConfigParam(command.getSocialSecuritySwitch(), command.getSocialSecurityLevelList());
//        checkProductPromotionCustomConfigParam(command.getAccumulationFundSwitch(), command.getAccumulationFundLevelList());
//        checkProductPromotionCustomConfigParam(command.getSesameSeedQuotaSwitch(), command.getSesameSeedQuotaList());
//        checkProductPromotionCustomConfigParam(command.getCreditCardSwitch(), command.getCreditCardList());
//        checkProductPromotionCustomConfigParam(command.getHouseLevelSwitch(), command.getHouseLevelList());
//        checkProductPromotionCustomConfigParam(command.getVehicleLevelSwitch(), command.getVehicleLevelList());
//        checkProductPromotionCustomConfigParam(command.getInsureSwitch(), command.getInsureList());
//        checkProductPromotionCustomConfigParam(command.getOccupationSwitch(), command.getOccupationList());
//        checkProductPromotionCustomConfigParam(command.getOccupationIncomeSwitch(), command.getOccupationIncomeList());
//        checkProductPromotionCustomConfigParam(command.getJdBtQuotaSwitch(), command.getJdBtQuotaList());
//        checkProductPromotionCustomConfigParam(command.getAntCreditPayQuotaSwitch(), command.getAntCreditPayQuotaList());
//        checkProductPromotionCustomConfigParam(command.getMicroLoanQuotaSwitch(), command.getMicroLoanQuotaList());
//        checkProductPromotionCustomConfigParam(command.getSexSwitch(), command.getSexList());
//        checkProductPromotionCustomConfigParam(command.getBeOverdueSwitch(), command.getBeOverdueList());
//        command.setOperator(SecurityUtils.X.getUser().getUsername());
//        return Result.success(productApplicationAdminService.operateProductPromotionCustomConfig(command));
//    }
//
//    @Operation(summary = "获取产品客户配置", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/getProductPromotionCustomConfig/{productId}")
//    public Result<ProductCustomConfigDTO> getProductPromotionCustomConfig(@Parameter(description = "产品id") @PathVariable Long productId) {
//        ProductCustomConfigDTO result = productQueryAdminService.getProductPromotionCustomConfig(productId);
//        return Result.success(result);
//    }
//
//    @Operation(summary = "操作产品投放配置（新增/更新）", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/operateProductPromotionThrowInConfig")
//    @Resubmit
//    @AutoLog(value = "操作产品投放配置")
//    public Result<Boolean> operateProductPromotionThrowInConfig(@Validated @RequestBody ProductThrowInConfigOperateCommand command) {
//        command.setPlacementRegion(command.getPlacementRegionList().stream().map(String::valueOf).collect(Collectors.joining(CommonConstants.COMMA)));
//        //全国时，把过滤城市设置空
//        if(ProductPlacementRegionTypeEnum.NATIONWIDE.getValue().equals(command.getPlacementRegionType())){
//            command.setPlacementRegion(StringUtils.EMPTY);
//        }
//        command.setPlacementPlatform(command.getPlacementPlatformList().stream().map(String::valueOf).collect(Collectors.joining(CommonConstants.COMMA)));
//        command.setLimitDay(command.getLimitDayList().stream().map(String::valueOf).collect(Collectors.joining(CommonConstants.COMMA)));
//        command.setPlacementPeriod(JacksonUtils.X.format(command.getPlacementPeriodList()));
//        command.setOperator(SecurityUtils.X.getUser().getUsername());
//        command.setUserProtocol(JacksonUtils.X.format(command.getUserProtocolList()));
//        return Result.success(productApplicationAdminService.operateProductPromotionThrowInConfig(command));
//    }
//
//    @Operation(summary = "获取产品投放配置", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/getProductPromotionThrowInConfig/{productId}")
//    public Result<ProductThrowInConfigDTO> getProductPromotionThrowInConfig(@Parameter(description = "产品id") @PathVariable Long productId) {
//        ProductThrowInConfigDTO result = productQueryAdminService.getProductPromotionThrowInConfig(productId);
//        result.setPlacementRegionList(getList(result.getPlacementRegion()));
//        result.setPlacementPlatformList(getList(result.getPlacementPlatform()));
//        result.setLimitDayList(getList(result.getLimitDay()));
//        result.setPlacementPeriodList(JacksonUtils.X.parse(result.getPlacementPeriod(), new TypeReference<>() {}));
//        // 用户协议
//        result.setUserProtocolList(JacksonUtils.X.parse(result.getUserProtocol(), new TypeReference<>() {}));
//        return Result.success(result);
//    }
//
//
//    @Operation(summary = "操作产品单价配置（新增/更新）", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/operateProductPromotionUnitPriceConfig")
//    @Resubmit
//    @AutoLog(value = "操作产品单价配置")
//    public Result<Boolean> operateProductPromotionUnitPriceConfig(@Validated @RequestBody ProductUnitPriceConfigOperateCommand command) {
//        command.setOperator(SecurityUtils.X.getUser().getUsername());
//        return Result.success(productApplicationAdminService.operateProductPromotionUnitPriceConfig(command));
//    }
//
//    @Operation(summary = "获取产品推广单价配置", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/geProductPromotionUnitPriceConfig/{productId}")
//    public Result<ProductUnitPriceConfigDTO> geProductPromotionUnitPriceConfig(@Parameter(description = "产品id") @PathVariable Long productId) {
//        ProductUnitPriceConfigDTO result = productQueryAdminService.geProductPromotionUnitPriceConfig(productId);
//        return Result.success(result);
//    }
//
//    @Operation(summary = "更新产品状态", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/updateProductStatus")
//    @PreAuthorize("@ss.hasPerm('core:product_status:edit')")
//    @Resubmit
//    @AutoLog(value = "更新产品状态")
//    public Result<Boolean> updateProductStatus(@Validated @RequestBody UpdateProductStatusCommand command) {
//        command.setEditor(SecurityUtils.X.getUser().getUsername());
//        return Result.success(productApplicationAdminService.updateProductStatus(command));
//    }
//
//    @Operation(summary = "分页查询产品列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/productPageQuery")
//    public PageResult<ProductPageDTO> productPageQuery(@Validated @RequestBody ProductPageCommand command) {
//        PageResult<ProductPageDTO> result = productQueryAdminService.productPageQuery(command);
//        if (result.getData().getList().isEmpty()) {
//            return result;
//        }
//        Set<Long> productIds = result.getData().getList().stream().map(ProductPageDTO::getId).collect(Collectors.toSet());
//        List<OrderCountDTO> productResult = orderQueryAdminService.listOrderCountByProductIds(productIds);
//        Map<Long, OrderCountDTO> productMap = productResult.stream().collect(Collectors.toMap(OrderCountDTO::getProductId, Function.identity()));
//        result.getData().getList().forEach(x -> {
//            OrderCountDTO countDTO = productMap.get(x.getId());
//            if(Objects.isNull(countDTO)) {
//                x.setProductLimit("0/" + x.getTotalLimit());
//            } else {
//                x.setProductLimit(countDTO.getCount() + "/" + x.getTotalLimit());
//            }
//        });
//        return result;
//    }
//
//    @Operation(summary = "产品对接方式", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/abutmentType")
//    public Result<List<Map>> abutmentType() {
//        List<Map> result = new ArrayList<>();
//        result.add(Map.of("abutmentType","自营","id","1"));
//        result.add(Map.of("abutmentType","h5","id","2"));
//        result.add(Map.of("abutmentType","api","id","3"));
//        result.add(Map.of("abutmentType","企业微信","id","4"));
//        result.add(Map.of("abutmentType","公众号","id","5"));
//        return Result.success(result);
//    }
//
//
//    @Operation(summary = "分页查询产品列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/export")
//    public ResponseEntity<byte[]> export(@Validated @RequestBody ProductPageCommand command) throws IOException {
//        List<ProductPageDTO> result = productQueryAdminService.productPageQueryList(command);
//
//        Set<Long> productIds = result.stream().map(ProductPageDTO::getId).collect(Collectors.toSet());
//        List<OrderCountDTO> productResult = orderQueryAdminService.listOrderCountByProductIds(productIds);
//        Map<Long, OrderCountDTO> productMap = productResult.stream().collect(Collectors.toMap(OrderCountDTO::getProductId, Function.identity()));
//        result.forEach(x -> {
//            OrderCountDTO countDTO = productMap.get(x.getId());
//            if(Objects.isNull(countDTO)) {
//                x.setProductLimit("0/" + x.getTotalLimit());
//            } else {
//                x.setProductLimit(countDTO.getCount() + "/" + x.getTotalLimit());
//            }
//        });
//        // 创建工作簿
//        Workbook workbook = new XSSFWorkbook();
//        // 创建工作表
//        Sheet sheet = workbook.createSheet("Sheet1");
//
//        // 创建标题行
//        Row headerRow = sheet.createRow(0);
//        // 设置表头
//        headerRow.createCell(0).setCellValue("产品id");
//        headerRow.createCell(1).setCellValue("商户名称");
//        headerRow.createCell(2).setCellValue("产品名称");
//        headerRow.createCell(3).setCellValue("当日进件/控量");
//        headerRow.createCell(4).setCellValue("产品类型");
//        headerRow.createCell(5).setCellValue("有效结算时间");
//        headerRow.createCell(6).setCellValue("权重");
//        headerRow.createCell(7).setCellValue("结算方式");
//        headerRow.createCell(8).setCellValue("操作人");
//        headerRow.createCell(9).setCellValue("操作时间");
//
//        // 填充数据 从第二行开始
//        int rowNum = 1;
//        for (ProductPageDTO dto : result) {
//            // 将Date对象格式化为指定格式的字符串
//            SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//            String editTime = "";
//            String limitTime = "";
//            if(dto.getEditTime()!=null){
//                editTime  = outputFormat.format(dto.getEditTime());
//
//            }
//
//            if(dto.getLimitDay()!=null){
//                limitTime = outputFormat.format(dto.getLimitDay());
//            }
//            // 将Date对象格式化为指定格式的字符串
//            Row row = sheet.createRow(rowNum);
//            row.createCell(0).setCellValue(dto.getId());
//            row.createCell(1).setCellValue(dto.getMerchantName());
//            row.createCell(2).setCellValue(dto.getProductName());
//            row.createCell(3).setCellValue(dto.getProductLimit());
//            row.createCell(4).setCellValue(dto.getProductType());
//            row.createCell(5).setCellValue(dto.getLimitDay());
//            row.createCell(6).setCellValue(dto.getWeight());
//            row.createCell(7).setCellValue(dto.getChargedWay());
//            row.createCell(8).setCellValue(dto.getEditor());
//            row.createCell(9).setCellValue(limitTime);
//            rowNum ++ ;
//        }
//
//        // 将工作簿写入 ByteArrayOutputStream
//        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
//        workbook.write(byteArrayOutputStream);
//
//        // 设置响应头
//        HttpHeaders headers = new HttpHeaders();
//        headers.setContentDispositionFormData("attachment", URLEncoder.encode("分页查询产品导出", StandardCharsets.UTF_8.toString()) + ".xlsx");
//        headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
//
//        // 返回 Excel 文件的字节数组
//        return new ResponseEntity<>(byteArrayOutputStream.toByteArray(), headers, HttpStatus.OK);
//
//
//    }
//
//
//    @Operation(summary = "产品结算单价列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/listProductCharged/{productId}")
//    public Result<List<ProductChargedListDTO>> listProductCharged(@Parameter(description = "产品id") @PathVariable(value = "productId") Long productId) {
//        List<ProductChargedListDTO> result = productQueryAdminService.listProductCharged(productId);
//        return Result.success(result);
//    }
//
//    @Operation(summary = "根据商户id获取产品列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/listProductByMerchantId")
//    public Result<List<ProductDetailDTO>> listProductByMerchantId(@Parameter(description = "商户id") @Valid @NotNull(message = "商户id不能为空") @RequestParam(value = "merchantId") Long merchantId,
//                                                                  @Parameter(description = "产品类型 1.信用贷 2.车抵贷 3.房抵贷 4.企业贷 5.商户贷") @RequestParam(value = "productType", required = false) Integer productType) {
//        List<ProductDetailDTO> result = productQueryAdminService.listProductByMerchantId(merchantId, productType);
//        return Result.success(result);
//    }
//
//    @Operation(summary = "根据商户id获取所有产品列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/listAllProductByMerchantId")
//    public Result<List<ProductDetailDTO>> listAllProductByMerchantId(@Parameter(description = "商户id") @Valid @NotNull(message = "商户id不能为空") @RequestParam(value = "merchantId") Long merchantId,
//                                                                  @Parameter(description = "产品类型 1.信用贷 2.车抵贷 3.房抵贷 4.企业贷 5.商户贷") @RequestParam(value = "productType", required = false) Integer productType) {
//        List<ProductDetailDTO> result = productQueryAdminService.listAllProductByMerchantId(merchantId, productType);
//        return Result.success(result);
//    }
//
//    @Operation(summary = "获取产品下拉列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/listProduct")
//    public Result<List<ProductListDTO>> listProduct() {
//        List<ProductListDTO> result = productQueryAdminService.listProduct();
//        return Result.success(result);
//    }
//
//    @Operation(summary = "获取所有产品", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/allProducts")
//    public Result<List<ProductListDTO>> allProducts() {
//        List<ProductListDTO> result = productQueryAdminService.allProducts();
//        return Result.success(result);
//    }
//
//
////    @Operation(summary = "查询产品禁用列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
////    @PostMapping("/getProductAdvanceChargeRecordDetail")
////    public Result<List<ProductListDTO>> getAListOfBannedProducts(@RequestBody ProductBanDetails productBanDetails) {
////        List<ProductListDTO> result = productQueryAdminService.getAListOfBannedProducts(productBanDetails);
////        return Result.success(result);
////    }
//
//
////    @Operation(summary = "更新渠道禁用产品关系", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
////    @PostMapping("/updateTheProductDisableRelationship")
////    public Result updateTheProductDisableRelationship(@RequestBody UpdateTheProductDisableRelationshipDto updateTheProductDisableRelationshipDto) {
////        Boolean flag = productQueryAdminService.updateTheProductDisableRelationship(updateTheProductDisableRelationshipDto);
////        return Result.success(result);
////    }
//
//
//
//    @Operation(summary = "获取除企微之外的产品下拉列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/listProductNAbutment")
//    public Result<List<ProductListDTO>> listProductNAbutment() {
//        List<ProductListDTO> result = productQueryAdminService.listProductNAbutment();
//        return Result.success(result);
//    }
//
//    @Operation(summary = "新增产品预付款记录", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/addProductAdvanceChargeRecord")
//    @PreAuthorize("@ss.hasPerm('core:product:advance:charge:add')")
//    @Resubmit
//    @AutoLog(value = "新增产品预付款记录")
//    public Result<Boolean> addProductAdvanceChargeRecord(@Validated @RequestBody AddProductAdvanceChargeRecordCommand command) {
//        command.setCreator(SecurityUtils.X.getUser().getUsername());
//        return Result.success(productApplicationAdminService.addProductAdvanceChargeRecord(command));
//    }
//
//    @Operation(summary = "更新产品预付款记录", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/updateProductAdvanceChargeRecord")
//    @PreAuthorize("@ss.hasPerm('core:product:advance:charge:edit')")
//    @Resubmit
//    @AutoLog(value = "更新产品预付款记录")
//    public Result<Boolean> updateProductAdvanceChargeRecord(@Validated @RequestBody UpdateProductAdvanceChargeRecordCommand command) {
//        command.setEditor(SecurityUtils.X.getUser().getUsername());
//        return Result.success(productApplicationAdminService.updateProductAdvanceChargeRecord(command));
//    }
//
//    @Operation(summary = "根据id获取产品预付款信息记录", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/getProductAdvanceChargeRecordDetail/{id}")
//    public Result<ProductAdvanceChargeRecordDetailDTO> getProductAdvanceChargeRecordDetail(@Parameter(description = "id") @PathVariable Long id) {
//        ProductAdvanceChargeRecordDetailDTO result = productQueryAdminService.getProductAdvanceChargeRecordDetail(id);
//        return Result.success(result);
//    }
//
//    @Operation(summary = "分页查询产品预付款记录列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/productAdvanceChargeRecordPageQuery")
//    public PageResult<ProductAdvanceChargeRecordPageDTO> productAdvanceChargeRecordPageQuery(@Validated @RequestBody ProductAdvanceChargeRecordPageCommand command) {
//        return productQueryAdminService.productAdvanceChargeRecordPageQuery(command);
//    }
//
//    @Operation(summary = "通过商户id获得已有的产品", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @GetMapping("/getProductListByMerchantId")
//    public Result<List<ProductInfoDO>> getProductListByMerchantId(@RequestParam("merchantId")Long merchantId) {
//        return Result.success(productQueryAdminService.getProductListByMerchantId(merchantId));
//    }
//
//    @Operation(summary = "产品预付款记录统计", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/productAdvanceChargeRecordStatistics")
//    public Result<ProductAdvanceChargeRecordStatisticsDTO> productAdvanceChargeRecordStatistics(@Validated @RequestBody ProductAdvanceChargeRecordPageCommand command) {
//        return Result.success(productQueryAdminService.productAdvanceChargeRecordStatistics(command));
//    }
//
//    @Operation(summary = "分页查询商户预付款列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/advanceChargePageQuery")
//    public PageResult<AdvanceChargePageDTO> advanceChargePageQuery(@Validated @RequestBody AdvanceChargePageCommand command) {
//        return productQueryAdminService.advanceChargePageQuery(command);
//    }
//
//    @Operation(summary = "更新产品禁止状态", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/updateProductProhibitStatus")
//    public Result<Boolean> updateProductProhibitStatus(@Validated @RequestBody UpdateProductProhibitStatusCommand command) {
//        command.setEditor(SecurityUtils.X.getUser().getUsername());
//        return Result.success(channelProhibitProductService.updateChannelProhibitProduct(command));
//    }
//
//
//    /**
//     * 检查产品客户配置参数
//     * @param valueSwitch valueSwitch
//     * @param value value
//     */
//    private void checkProductPromotionCustomConfigParam(Integer valueSwitch, Integer value){
//        if (ProductCustomSwitchStatusEnum.OPEN.getValue().equals(valueSwitch) && Objects.isNull(value)) {
//            throw new BusinessException(AdminResultCode.PARAM_ERROR);
//        }
//    }
//
//    /**
//     * 检查产品客户配置参数
//     * @param valueSwitch valueSwitch
//     * @param value value
//     */
//    private void checkProductPromotionCustomConfigParam(Integer valueSwitch, List<Integer> value){
//        if (ProductCustomSwitchStatusEnum.OPEN.getValue().equals(valueSwitch) && (Objects.isNull(value) || value.isEmpty())) {
//            throw new BusinessException(AdminResultCode.PARAM_ERROR);
//        }
//    }
//
//    /**
//     * 带,字符串转String类型数组
//     * @param str str
//     * @return  List<String>
//     */
//    private List<String> getList(String str) {
//        if (StringUtils.isBlank(str)) {
//            return CollUtil.newArrayList();
//        }
//        return List.of(str.split(","));
//    }
//
//}
